package app.mvc.controller.app
{
	import app.mvc.model.proxys.AppMainProxy;
	import app.mvc.view.AppMainView;
	import app.mvc.view.mediators.AppViewMediator;
	import app.mvc.view.mediators.BackgroundViewMediator;
	import app.mvc.view.mediators.ObjectsViewMediator;
	
	import flash.display.Bitmap;
	
	import org.puremvc.as3.interfaces.INotification;
	import org.puremvc.as3.patterns.command.SimpleCommand;
	
	import utils.Tracker;
	import utils.UtilsGraphics;
	
	public class StartOverCommand extends SimpleCommand
	{
		public function StartOverCommand()
		{
			super();
		}
		
		override public function execute(notification:INotification):void
		{
			// TODO Auto Generated method stub
			super.execute(notification);
			
			var appEditor:UIEditor = notification.getBody()["app"] as UIEditor;
			var appView:AppMainView = notification.getBody()["appView"] as AppMainView;
			appEditor.addChild(appView);
			Tracker.say("start up over");
			
			//注册代理（Proxy）
			facade.registerProxy(new AppMainProxy());
			
			//注册Mediator UI组件的中介器
			facade.registerMediator(new AppViewMediator(AppViewMediator.NAME,appView));
			facade.registerMediator(new BackgroundViewMediator(BackgroundViewMediator.NAME,appView.backgroundLayer));
			facade.registerMediator(new ObjectsViewMediator(ObjectsViewMediator.NAME,appView.objectsLayer));
			
			//加载配置文件
			(facade.retrieveProxy(AppMainProxy.NAME) as AppMainProxy).loadConfig();
		}
		
	}
}